package com.mrdeer.iot.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.mrdeer.common.base.Converter;
import com.mrdeer.common.entity.beans.PageEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import com.mrdeer.iot.entity.ShopEntity;
import org.springframework.beans.BeanUtils;

/**
 * @Author: xie jianchu
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class ShopEntityDTO extends ShopEntity implements Converter<ShopEntity, ShopEntityDTO> {

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private PageEntity pageEntity;

    @Override
    public void convert2Do(ShopEntity shopEntity) {
        BeanUtils.copyProperties(shopEntity, this);
    }

    @Override
    public ShopEntityDTO convert(ShopEntity shopEntity) {
        BeanUtils.copyProperties(this, shopEntity);
        return this;
    }
}
